# -*- cmake -*-
#
# @file OpenRTMConfig.cmake
# @brief cmake-config file for OpenRTM-aist on Windows
# @date Fri Mar 30 14:55:25 2018 
#
# This file is used for cmake config-mode.
# The following variables are defined.
#
# Basic compiler/linker options
# - OPENRTM_CFLAGS: cflags 
# - OPENRTM_INCLUDE_DIRS: include directories
# - OPENRTM_LDFLAGS: linker options
# - OPENRTM_LIBRARY_DIRS: library directories
# - OPENRTM_LIBRARIES: libraries
# - OPENRTM_LIB_DIR: OpenRTM's lib directory
#
# OpenRTM-aist specific directory
# - COIL_INCLUDE_DIR: coil include dir
#
# OpenRTM-aist version
# - OPENRTM_VERSION: x.y.z version
# - OPENRTM_VERSION_MAJOR: major version number
# - OPENRTM_VERSION_MINOR: minor version number
# - OPENRTM_VERSION_PATCH: revision number
# - OPENRTM_SHORT_VERSION: short version number 1.1.0->110
#
# OpenRTM-aist's CORBA related settings
# - OPENRTM_ORB: CORBA implementation
# - OPENRTM_IDL_WRAPPER: rtm-skelwrapper command
# - OPENRTM_IDL_WRAPPER_FLAGS: rtm-skelwrapper flag
# - OPENRTM_IDLC: IDL command
# - OPENRTM_IDLFLAGS: IDL optins







message(STATUS "OpenRTMConfig.cmake found.")
message(STATUS "Configrued by configuration mode.")

# OpenRTM-aist version
set(OPENRTM_VERSION @RTM_VERSION@)
set(OPENRTM_VERSION_MAJOR @RTM_MAJOR_VERSION@)
set(OPENRTM_VERSION_MINOR @RTM_MINOR_VERSION@)
set(OPENRTM_VERSION_PATCH @RTM_REVISION_NUM@)
set(OPENRTM_SHORT_VERSION @RTM_VERSION@)

#get_filename_component(OPENRTM_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
#set(OPENRTM_DIR "${OPENRTM_DIR}../..")
string(REGEX REPLACE "/$" "" OPENRTM_DIR "${OPENRTM_DIR}")

# TAO version
set(TAO_DIR "${OPENRTM_DIR}/ACE/vc${MSVC_TOOLSET_VERSION}")
set(TAO_CFLAGS @ORB_C_FLAGS_LIST@;)
set(TAO_INCLUDE_DIRS ${TAO_DIR} ${TAO_DIR}/TAO ${TAO_DIR}/TAO/orbsvcs)
set(TAO_LDFLAGS )
set(TAO_LIBRARY_DIRS ${TAO_DIR}/lib)
set(TAO_LIBRARIES @ORB_LIBRARIES@)


# Basic compiler/linker options
set(OPENRTM_CFLAGS @RTM_C_FLAGS_LIST@;-DNOMINMAX)
set(OPENRTM_INCLUDE_DIRS ${OPENRTM_DIR};${OPENRTM_DIR}/rtm/idl;${OPENRTM_DIR}/rtm/ext)
set(OPENRTM_LDFLAGS )



get_filename_component(OpenRTM_CONFIG2_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
set(OPENRTM_BIN_PATH "${OPENRTM_DIR}/bin")
file(GLOB rtm_libs "${OpenRTM_CONFIG2_PATH}/RTC*.lib")
foreach(rtm_lib ${rtm_libs})
  if(EXISTS "${rtm_lib}")
    set(OPENRTM_BIN_PATH ${OpenRTM_CONFIG2_PATH})
  endif()
endforeach()
message(STATUS "OPENRTM_BIN_PATH=${OPENRTM_BIN_PATH}")


set(OPENRTM_LIBRARY_DIRS ${OPENRTM_BIN_PATH};${TAO_DIR}/lib/@ARCH_NAME@)
set(OPENRTM_LIBRARIES @OPENRTM_LIBRARIES@;${TAO_LIBRARIES})


set(OPENRTM_CFLAGS ${OPENRTM_CFLAGS} ${TAO_CFLAGS})
set(OPENRTM_INCLUDE_DIRS ${OPENRTM_INCLUDE_DIRS} ${TAO_INCLUDE_DIRS})
set(OPENRTM_LDFLAGS ${OPENRTM_LDFLAGS} ${TAO_LDFLAGS})
set(OPENRTM_LIBRARY_DIRS ${OPENRTM_LIBRARY_DIRS} ${TAO_LIBRARY_DIRS})



# OpenRTM-aist specific directory
set(COIL_INCLUDE_DIR ${OPENRTM_DIR}/bin)

# OpenRTM-aist's CORBA related settings
set(OPENRTM_ORB TAO)
set(OPENRTM_IDL_WRAPPER rtm-skelwrapper.py)
set(OPENRTM_IDL_WRAPPER_FLAGS --include-dir=;--skel-suffix=Skel;--stub-suffix=Stub;--dependencies=@RTM_INCLUDE_IDLS@)
set(OPENRTM_IDLC tao_idl)
set(OPENRTM_IDLFLAGS -as -DTAO_IDL -I${TAO_DIR}/TAO -I${OPENRTM_DIR}/rtm/idl)


message(STATUS "OpenRTM-aist configuration done")

message(STATUS "  TAO_DIR=${TAO_DIR}")
message(STATUS "  TAO_VERSION=${TAO_VERSION}")
message(STATUS "  TAO_CFLAGS=${TAO_CFLAGS}")
message(STATUS "  TAO_INCLUDE_DIRS=${TAO_INCLUDE_DIRS}")
message(STATUS "  TAO_LDFLAGS=${TAO_LDFLAGS}")
message(STATUS "  TAO_LIBRARY_DIRS=${TAO_LIBRARY_DIRS}")
message(STATUS "  TAO_LIBRARIES=${TAO_LIBRARIES}")

message(STATUS "  OPENRTM_DIR=${OPENRTM_DIR}")
message(STATUS "  OPENRTM_VERSION=${OPENRTM_VERSION}")
message(STATUS "  OPENRTM_VERSION_MAJOR=${OPENRTM_VERSION_MAJOR}")
message(STATUS "  OPENRTM_VERSION_MINOR=${OPENRTM_VERSION_MINOR}")
message(STATUS "  OPENRTM_VERSION_PATCH=${OPENRTM_VERSION_PATCH}")
message(STATUS "  OPENRTM_CFLAGS=${OPENRTM_CFLAGS}")
message(STATUS "  OPENRTM_INCLUDE_DIRS=${OPENRTM_INCLUDE_DIRS}")
message(STATUS "  OPENRTM_LDFLAGS=${OPENRTM_LDFLAGS}")
message(STATUS "  OPENRTM_LIBRARY_DIRS=${OPENRTM_LIBRARY_DIRS}")
message(STATUS "  OPENRTM_LIBRARIES=${OPENRTM_LIBRARIES}")

message(STATUS "  OPENRTM_IDLC=${OPENRTM_IDLC}")
message(STATUS "  OPENRTM_IDLFLAGS=${OPENRTM_IDLFLAGS}")
message(STATUS "  OPENRTM_IDL_WRAPPER=${OPENRTM_IDL_WRAPPER}")
message(STATUS "  OPENRTM_IDL_WRAPPER_FLAGS=${OPENRTM_IDL_WRAPPER_FLAGS}")

# end of OpenRTMConfig.cmake


